﻿using Domain.Entity;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Numerics;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Channels;
using System.Threading.Tasks;

namespace EFCore
{
    public class MyDbContext:DbContext
    {

		/// <summary>
		/// 1 配置连接字符串
		/// </summary>
		/// <param name="optionsBuilder"></param>
		protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            string connStr = @"Data Source=.;Initial Catalog=HumanResourceManagementSystem;Integrated Security=True;Encrypt=False;";

            optionsBuilder.UseSqlServer(connStr);


            optionsBuilder.LogTo(msg =>
            {
                if (!msg.Contains("CommandExecuting"))
                {
                    return;
                }
                Console.WriteLine(msg);

            });
        }
        //2 读取配置类
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.ApplyConfigurationsFromAssembly(this.GetType().Assembly);
        }
        public DbSet<Bonus> Bonus { get; set; }//角色

        public DbSet<CFFK> CFFK { get; set; }
        public DbSet<CFSK> CFSK { get; set; }
        public DbSet<CFTK> CFTK { get; set; }
        public DbSet<CM> CM { get; set; }
        public DbSet<CMK> CMK { get; set; }
        public DbSet<CPC> CPC { get; set; }
        public DbSet<CQFK> CQFK { get; set; }
        public DbSet<CQSK> CQSK { get; set; }
        public DbSet<EA> EA { get; set; }
        public DbSet<EAD> EAD { get; set; }
        public DbSet<EE> EE { get; set; }//用户
        public DbSet<EED> EED { get; set; }
        public DbSet<EI> EI { get; set; }
        public DbSet<EMR> EMR { get; set; }
        public DbSet<ER> ER { get; set; }
        public DbSet<ES> ES { get; set; }
        public DbSet<GroupMenu> GroupMenu { get; set; }
        public DbSet<HF> HF { get; set; }
        public DbSet<HFD> HFD { get; set; }
        public DbSet<Jurisdiction> Jurisdiction { get; set; }
        public DbSet<MC> MC { get; set; }
        public DbSet<Roles> Roles { get; set; }
        public DbSet<RolesJurisdiction> RolesJurisdiction { get; set; }
        public DbSet<SG> SG { get; set; }
        public DbSet<SGD> SGD { get; set; }
        public DbSet<SS> SS { get; set; }
        public DbSet<SSD> SSD { get; set; }
        public DbSet<Training> Training { get; set; }
        public DbSet<User> User { get; set; }
        public DbSet<UserRoles> UserRolesSelect { get; set; }

    }
}
